package ywpt.service.people;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.springframework.stereotype.Service;

import ywpt.core.dao.HibernateEntityDao;
import ywpt.model.BsnssOptntInfo;
import ywpt.model.ClientInfo;
import ywpt.model.CommonTable;
import ywpt.service.client.ClientService;
@Service("bsnssOptntInfoService")
public class BsnssOptntInfoServiceImpl extends HibernateEntityDao<BsnssOptntInfo> implements
		BsnssOptntInfoService {

	public BsnssOptntInfo getBsnssOptntInfoById(Long id) {
		// TODO �Զ���ɷ������
		return this.get(id);
	}

	public int getBsnssOptntInfoCountByCriteria(DetachedCriteria query) {
		// TODO �Զ���ɷ������
		return this.getCountByCriteria(query);
	}

	public List<BsnssOptntInfo> getBsnssOptntInfos(DetachedCriteria query,
			int pageSize, int startIndex) {
		// TODO �Զ���ɷ������
		return this.findAllByCriteria(query, pageSize, startIndex);
	}

	public List<BsnssOptntInfo> getBsnssOptntInfos() {
		// TODO �Զ���ɷ������
		return this.getAll();
	}

	public List<BsnssOptntInfo> getBsnssOptntInfos(DetachedCriteria query) {
		// TODO �Զ���ɷ������
		return this.findAllByCriteria(query);
	}

	public void removeBsnssOptntInfo(Long id) {
		// TODO �Զ���ɷ������
		super.removeById(id);
	}

	public void saveBsnssOptntInfo(BsnssOptntInfo bsnssOptntInfo) {
		// TODO �Զ���ɷ������
		super.save(bsnssOptntInfo);
	}

	public void updateBsnssOptntInfo(BsnssOptntInfo bsnssOptntInfo) {
		// TODO �Զ���ɷ������
		super.update(bsnssOptntInfo);
	}
	public void updateBsnssOptntInfo(BsnssOptntInfo bsnssOptntInfo, Long clientId,Long chance_state) {
		// TODO �Զ���ɷ������
		bsnssOptntInfo.setClientInfo(this.get(ClientInfo.class,clientId));
		bsnssOptntInfo.setChance_state(this.get(CommonTable.class,chance_state));		
		super.update(bsnssOptntInfo);
	}
	
	public void saveBsnssOptntInfo(BsnssOptntInfo bsnssOptntInfo, Long clientId,Long chance_state) {
		// TODO �Զ���ɷ������
		bsnssOptntInfo.setClientInfo(this.get(ClientInfo.class,clientId));
		bsnssOptntInfo.setChance_state(this.get(CommonTable.class,chance_state));
		super.save(bsnssOptntInfo);
	}

}
